import request from '@/utils/request'
import { parseStrEmpty } from "@/utils/ruoyi";

// 查询卡券列表
export function listCoupon(data) {
  return request({
    url: '/market/coupon/couponList',
    method: 'post',
    data: data
  })
}

// 查询卡券详细
export function getCoupon(couponId) {
  return request({
    url: '/market/coupon/' + parseStrEmpty(couponId),
    method: 'get'
  })
}

// 新增卡券
export function addCoupon(data) {
  return request({
    url: '/market/coupon',
    method: 'post',
    data: data
  })
}

// 修改卡券
export function updateCoupon(data) {
  return request({
    url: '/market/coupon',
    method: 'put',
    data: data
  })
}

// 删除卡券
export function delCoupon(couponId) {
  return request({
    url: '/market/coupon/' + couponId,
    method: 'delete'
  })
}

// 卡券状态修改
export function changeCouponStatus(couponId, status) {
  const data = {
    couponId,
    status
  }
  return request({
    url: '/market/coupon/couponChangeStatus',
    method: 'put',
    data: data
  })
}
